﻿//-----------------------------------------------------------------------
// <copyright file="PersonViewModel.cs" company="OverrideThis">
//     Copyright (c) 2010 OverrideThis.com
// </copyright>
//-----------------------------------------------------------------------
namespace OverrideThis.ContactManager.WebSite.Models
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Web.Mvc;

    public class PersonListViewModel
    {
        public PersonListViewModel()
        {
            this.SelectedPersonId = 0;
        }

        public KeyValuePair<string, string>[] TypeOfContact { get; set; }

        public PersonViewModel[] Persons { get; set; }

        public int SelectedPersonId { get; set; }
    }

    public class PersonViewModel
    {
        [HiddenInput(DisplayValue = false)]
        public int Id { get; set; }
        
        [Required(AllowEmptyStrings = false)]
        public string Lastname { get; set; }

        [Required(AllowEmptyStrings = false)]
        public string Firstname { get; set; }
        
        [DisplayName("Country")]
        public string CountryDescription { get; set; }

        [Required, DataType(DataType.Date)]
        public DateTime? BirthDate { get; set; }
        
        public ContactViewModel[] Contacts { get; set; }

        public KeyValuePair<string, string>[] TypeOfContact { get; set; }
    }

    public class PersonEditViewModel : PersonViewModel
    {
        public KeyValuePair<string, string>[] Country { get; set; }
    }
}